package de.neua;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;

/**
 * This activity shows the borrowed media after login.
 * 
 * @author neua
 * 
 */

public class Media extends Activity {
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.media);
		ArrayList<Entry> entries = getIntent().getParcelableArrayListExtra(
				"entries");
		TableLayout tv = (TableLayout) findViewById(R.id.borrowedMediaTable);
		for (Entry entry : entries) {
			TableRow tr = new TableRow(getApplicationContext());
			TextView text = new TextView(getApplicationContext());
			text.setText(entry.getLendingPeriod().get(Calendar.DATE)+"."+(entry.getLendingPeriod().get(Calendar.MONTH)+1)+"."+entry.getLendingPeriod().get(Calendar.YEAR));
			tr.addView(text);
			text = new TextView(getApplicationContext());
			text.setText(entry.getName());
			text.setPadding(20, 3, 3, 3);
			text.setGravity(android.view.Gravity.RIGHT);
			tr.addView(text);
			tv.addView(tr);
		}
	}
}
